Skip to content
This repository was archived by the owner on Nov 10, 2026. It is now read-only.

fix: ignore members of types that fail to load - #203

Merged
vbreuss merged 1 commit into
mainfrom
fix/harden-member-loading
May 27, 2026
Merged

vbreuss merged 1 commit into
mainfrom
fix/harden-member-loading

Conversation

@vbreuss

@vbreuss vbreuss commented May 27, 2026

Copy link
Copy Markdown
Member

Reflecting over the members of a successfully loaded type can throw when a member signature references a type from an assembly that cannot be resolved. Guard each GetDeclared* helper with a try/catch that falls back to an empty array on TypeLoadException, FileNotFoundException or FileLoadException, so a single unloadable member no longer aborts the whole query.

The caught set is scoped to exceptions these member getters can actually raise: ReflectionTypeLoadException (only thrown by Assembly/Module type enumeration) and BadImageFormatException (thrown at assembly load time) are intentionally excluded.

Reflecting over the members of a successfully loaded type can throw when a member signature references a type from an assembly that cannot be resolved. Guard each GetDeclared* helper with a try/catch that falls back to an empty array on TypeLoadException, FileNotFoundException or FileLoadException, so a single unloadable member no longer aborts the whole query.

The caught set is scoped to exceptions these member getters can actually raise: ReflectionTypeLoadException (only thrown by Assembly/Module type enumeration) and BadImageFormatException (thrown at assembly load time) are intentionally excluded.
@vbreuss vbreuss self-assigned this May 27, 2026
@vbreuss vbreuss added the bug Something isn't working label May 27, 2026
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Test Results

    13 files  ± 0      13 suites  ±0   2m 47s ⏱️ -12s
 3 082 tests + 4   3 079 ✅ + 4   3 💤 ±0  0 ❌ ±0 
18 472 runs  +24  18 459 ✅ +24  13 💤 ±0  0 ❌ ±0 

Results for commit 31103d3. ± Comparison against base commit a91c278.

@vbreuss
vbreuss merged commit 65a408a into main May 27, 2026
11 checks passed
@vbreuss
vbreuss deleted the fix/harden-member-loading branch May 27, 2026 11:11
@github-actions

Copy link
Copy Markdown

👽 Mutation Results

Mutation testing badge

aweXpect.Reflection

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
Helpers/TypeHelpers.cs 98.22% 166 1 0 2 51 12 166 3 232

The final mutation score is 98.22%

Coverage Thresholds: high:80 low:60 break:0

@github-actions

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 9V74 2.60GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.300
[Host] : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3

Method Mean Error StdDev Gen0 Allocated
TypeIsNotStatic_aweXpect 208.4 ns 0.89 ns 0.79 ns 0.0386 648 B

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant